package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.RoleDao;
import com.xtedu.examproject.dao.impl.RoleDaoImpl;
import com.xtedu.examproject.entity.Role;
import com.xtedu.examproject.entity.Teacher;
import com.xtedu.examproject.util.PageHelper;

import java.util.List;

public class RoleService {
    private RoleDao roleDao;

    public RoleService(){
        roleDao = new RoleDaoImpl();
    }

    public List<Role> findRolesByMenuId(int menuId) throws Exception {
        return roleDao.findRolesByMenuId(menuId);
    }
    public int insert(Role role) throws Exception {
        return roleDao.insert(role);
    }
    public int update(Role role) throws Exception {
        return roleDao.update(role);
    }
    public int delete(Role role) throws Exception {
        return roleDao.delete(role);
    }
    public Role findById(int id) throws Exception {
        return roleDao.findById(id);
    }
    public List<Role> findAll() throws Exception {
        return roleDao.findAll();
    }
    public List<Role> findAllRoleInfo() throws Exception{
        return roleDao.findAllRoleInfo();
    }
    public Role findRoleById(int roleId) throws Exception {
        return roleDao.findById(roleId);
    }

    public PageHelper findAllByPage(int pageindex, int pagesize) throws Exception {
        return roleDao.findAllByPage(pageindex, pagesize);
    }
    public boolean deleteRoleById(int id) throws  Exception{
        return roleDao.deleteRoleById(id);
    }

    public boolean updateRole(Role role) throws Exception{
    	return roleDao.updateRole(role);
    }
}
